package com.hlw.hr_man.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hlw.hr_man.service.AskForLeaveService;
import com.hlw.hr_man.serviceImpl.AskForLeaveServiceImpl;

/**
 * 
 * @ClassName: TerminateAflController
 * @Description: 处理销假请求
 * @author 唐明
 * @date 2016年9月20日 上午10:21:39
 *
 */
public class TerminateAflController extends HttpServlet{

	/**
	 * @Fields serialVersionUID : TODO(用一句话描述这个变量表示什么)
	 */ 
	private static final long serialVersionUID = 1L;
	
	AskForLeaveService aflService = new AskForLeaveServiceImpl();

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(req, resp);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		int afl_id = Integer.parseInt(req.getParameter("ask_id"));
		int temp = aflService.updateAfl(afl_id);
		PrintWriter pw = resp.getWriter();
		if (temp == 1) {
			pw.write("1");
		} else {
			pw.write("0");
		}
	}
}
